package models

// Role [...]
type Role struct {
	ID uint `gorm:"primary_key" json:"id"`
	AotuTimeModel
	Name       string       `gorm:"column:name;type:varchar(100)" json:"name"`         // 角色名称
	Describe   string       `gorm:"column:describe;type:varchar(255)" json:"describe"` // 描述
	Member     []Member     `gorm:"many2many:member_role;" json:"member"`
	Permission []Permission `gorm:"many2many:role_permission;" json:"permission"`
}

// TableName get sql table name.获取数据库表名
func (m *Role) TableName() string {
	return "role"
}

// RoleColumns get sql column name.获取数据库列名
var RoleColumns = struct {
	ID        string
	Name      string
	Describe  string
	CreatedAt string
	UpdatedAt string
}{
	ID:        "id",
	Name:      "name",
	Describe:  "describe",
	CreatedAt: "created_at",
	UpdatedAt: "updated_at",
}
